home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / ear / amtc4142.lha / AmiTCP-41-to-42-pch / Patch_AmiTCP_4.1 < prev    next >
Text File  |  1995-03-10  |  10KB  |  348 lines

  1. ;;;; Hey Emacs, this script might as well be -*- lisp -*-
  2. ;;;;
  3. ;;;; Patch_AmiTCP_4.1 - AmiTCP/IP patch script for Installer
  4. ;;;;
  5. ;;;; Copyright © 1995 AmiTCP/IP Group,
  6. ;;;;                  NSDi - Network Solutions Development Inc., Finland
  7. ;;;;                  All rights reserved.
  8. ;;;;
  9. ;;;; $Id: Patch_AmiTCP,v 4.4 1995/01/18 00:03:24 ppessi Exp $
  10. ;;;;
  11. ;;;; This script has been tested with Installer 1.24:
  12. ;;;;
  13. ;;;;     Installer and Installer project icon
  14. ;;;;     (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  15. ;;;;     Reproduced and distributed under license from Commodore.
  16. ;;;;
  17. ;;;;     INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
  18. ;;;;     NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
  19. ;;;;     OR RESPONSIBILITY IS ASSUMED.
  20. ;;;;
  21. ;;;; Use following Icon tooltypes / Command line options:
  22. ;;;; APPNAME=AmiTCP/IP
  23. ;;;; MINUSER=AVERAGE
  24. ;;;;
  25. (welcome "    Welcome to the patch of " @app-name " 4.1.\n")
  26. ;;;;
  27. ;;;; What we are?
  28. ;;;;
  29. (set app-name (cat @app-name " 4.1"))
  30.  
  31. ;;;
  32. ;;; Destination directories of the AmiTCP/IP
  33. ;;;
  34. (set 
  35.  atcp-name "AmiTCP"
  36.  atcp-assign (cat atcp-name ":")    ; Assign to AmiTCP
  37.  ;; Configuration
  38.  conf-dir (tackon atcp-assign "db")
  39.  ;; User binaries
  40.  bin-dir (tackon atcp-assign "bin")
  41.  ;; AmigaGuide documentation
  42.  help-dir (tackon atcp-assign "help")
  43.  ;; The source directory name
  44.  source-dir (if (= 1 (exists @icon))
  45.             (pathonly (expandpath @icon))
  46.           (expandpath @icon))
  47.  ;; Destination file
  48.  @default-dest "t:"
  49.  )
  50.  
  51. (set 
  52.  release-note-file "Release_Notes_4.2")
  53.  
  54. ;;; copy "more" to ram: to be able to use it
  55. (set
  56.  pager-cmd 
  57.  (if (exists "SYS:Utilities/More" (noreq))
  58.      ((copyfiles
  59.        (prompt "Copying sys:utilities/more to ram: for use")
  60.        (source "SYS:Utilities/More")
  61.        (dest   "RAM:")
  62.        (safe)
  63.        (optional "nofail"))
  64.       "RAM:More")
  65.    ("more"))
  66.  )
  67.  
  68. ;; Restore old version on error
  69. (onerror
  70.  0) ; not implemented yet
  71.  
  72. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  73. (procedure
  74.  check-user-level
  75.  ;;
  76.  (transcript "Checking user level.")
  77.  (if (< @user-level 1)
  78.      ((transcript "Installation aborted due to too low user level.")
  79.       (abort "AmiTCP/IP installation requires at least the \"average\" "
  80.          "user level. Restart installation and select appropriate user "
  81.          "level."))))
  82.  
  83. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  84. (procedure
  85.  check-atcp-assign
  86.  ;; Check that AmiTCP is installed
  87.  (transcript "Checking for already installed AmiTCP.")
  88.  (if (exists atcp-assign (noreq))
  89.      (set current-atcp-directory (getassign atcp-name))
  90.    ((transcript "Installation aborted due to lacking AmiTCP: assign.")
  91.     (abort "AmiTCP/IP configuration requires that AmiTCP/IP is installed on "
  92.        "your system. The configuration tool could not find the AmiTCP: "
  93.        "assign, so the configuration cannot be completed. "
  94.        "Please install AmiTCP: from the AmiTCP/IP installation disk."
  95.        ))))
  96.  
  97. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  98. ;;;
  99. ;;; Check that the old AmiTCP/IP binary is really 4.1
  100. ;;;
  101. (procedure 
  102.  check-amitcp-41
  103.  (set vernum (getversion (tackon atcp-assign "AmiTCP")))
  104.  (set ver (shiftright vernum 16))
  105.  (set rev (bitand vernum 65535))
  106.  (if (or (<> ver 4) (<> rev 1))
  107.      (abort "This patch can be installed over " app-name " only.")))
  108.  
  109. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  110. ;;;
  111. ;;; Patch a file if its checksum matches 
  112. ;;;
  113. (procedure 
  114.  patch-file
  115.  ;;(file-name patch-file-name)
  116.  (set 
  117.   full-file-name (tackon atcp-assign file-name)
  118.   temp-file-name (tackon "t:" (fileonly file-name)))
  119.  
  120.  (if (exists full-file-name)
  121.      (
  122.       (copyfiles 
  123.        (source full-file-name)
  124.        (dest "t:")
  125.        (newname (fileonly file-name))
  126.        (safe))
  127.       (set patch-result
  128.        (run (cat "patch"
  129.              " " temp-file-name 
  130.              " \"" (tackon source-dir patch-file-name) "\""
  131.              ) (safe)))
  132.       (transcript ("patch result code %ld" patch-result))
  133.       (if (= patch-result 0)
  134.       (
  135.        (set rename-result 
  136.         (rename full-file-name (cat full-file-name ".old")))
  137.        (transcript ("Rename results %ld" rename-result))
  138.        (if (<> rename-result 0)
  139.            (copyfiles
  140.         (prompt "Copying " temp-file-name " as " full-file-name)
  141.         (files)
  142.         (source temp-file-name)
  143.         (dest (pathonly full-file-name))
  144.         (newname (fileonly full-file-name))
  145.         (optional "nofail"))
  146.          (message "Cannot patch " full-file-name ".\nContinue patch?")))
  147.     (message "Cannot patch " full-file-name ".\nContinue patch?"))
  148.       (delete temp-file-name (safe)))
  149.    (message "Cannot patch: " full-file-name " does not exist.\nContinue patch?"))
  150.  )
  151. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  152. ;;;
  153. ;;; SAS-Patch a file if its checksum matches 
  154. ;;;
  155. (procedure 
  156.  spatch-file-1
  157.  ;;(file-name checksum spatch-file-name old-version)
  158.  (set full-file-name (tackon atcp-assign file-name))
  159.  
  160.  (if (exists full-file-name)
  161.      (
  162.       (working "\nCalculating checksum on " full-file-name 
  163.            "\nthis may take some time.")
  164.       (set real-sum (getsum full-file-name))
  165.       (transcript full-file-name (" sum is $%08lx" real-sum))
  166.       (if (= real-sum checksum)
  167.       (
  168.        (set temp-file-name (tackon "t:" (fileonly file-name)))
  169.        (set spatch-result
  170.         (run (cat "spatch"
  171.               " -o" temp-file-name 
  172.               " -p" spatch-file-name
  173.               " " full-file-name) 
  174.              (safe)))
  175.        (if (and (= spatch-result 0)
  176.             (rename
  177.              full-file-name
  178.              (cat full-file-name ".old")))
  179.            ((copyfiles
  180.          (prompt "Copying " temp-file-name " as " full-file-name)
  181.          (files)
  182.          (source temp-file-name)
  183.          (dest (pathonly full-file-name))
  184.          (newname (fileonly full-file-name))
  185.          (optional "nofail")))
  186.          (message "Cannot spatch " full-file-name ".\nContinue patch?"))
  187.        (delete temp-file-name (safe)))
  188.     (message "File " full-file-name " is not original.\nContinue patch?")))
  189.       (message "Cannot patch: " full-file-name " does not exist.\nContinue patch?"))
  190.  )
  191.  
  192. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  193. ;;;
  194. ;;; SAS-patch a file if its checksum matches 
  195. ;;;
  196. (procedure 
  197.  spatch-file-2
  198.  ;;(file-name checksum-1 spatch-1 checksum-2 spatch-2 old-version)
  199.  (set full-file-name (tackon atcp-assign file-name))
  200.  
  201.   (if (exists full-file-name)
  202.      (
  203.       (working "\nCalculating checksum on " full-file-name)
  204.       (set real-sum (getsum full-file-name))
  205.       (if (= real-sum checksum-1)
  206.       (
  207.        (set temp-file-name (tackon "t:" (fileonly file-name)))
  208.        (set spatch-result
  209.         (run (cat "spatch"
  210.               " -o" temp-file-name 
  211.               " -p" spatch-1
  212.               " " full-file-name) (safe)))
  213.        (if (and (= spatch-result 0)
  214.             (rename
  215.              full-file-name
  216.              (cat full-file-name ".old")))
  217.            ((copyfiles
  218.          (prompt "Copying " temp-file-name " as " full-file-name)
  219.          (files)
  220.          (source temp-file-name)
  221.          (dest (pathonly full-file-name))
  222.          (newname (fileonly full-file-name))
  223.          (optional "nofail")))
  224.          (message "Cannot spatch " full-file-name ".\nContinue patch?"))
  225.        (delete temp-file-name (safe)))
  226.     (if (= real-sum checksum-2)
  227.         (
  228.          (set temp-file-name (tackon "t:" (fileonly file-name)))
  229.          (set spatch-result
  230.           (run (cat "spatch"
  231.                 " -o" temp-file-name 
  232.                 " -p" spatch-2
  233.                 " " full-file-name) (safe)))
  234.          (if (and (= spatch-result 0)
  235.               (rename
  236.                full-file-name
  237.                (cat full-file-name ".old")))
  238.          ((copyfiles
  239.            (prompt "Copying " temp-file-name " as " full-file-name)
  240.            (files)
  241.            (source temp-file-name)
  242.            (dest (pathonly full-file-name))
  243.            (newname (fileonly full-file-name))
  244.            (optional "nofail")))
  245.            (message "Cannot spatch " full-file-name ".\nContinue patch?"))
  246.          (delete temp-file-name (safe))))
  247.     (message "File " full-file-name " is not original.\nContinue patch?")))
  248.     (message "Cannot patch: " full-file-name " does not exist.\nContinue patch?"))
  249.   )
  250.  
  251.         
  252. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  253. ;;;
  254. ;;; Installatation sequence
  255. ;;;
  256. (run (cat "run " pager-cmd) release-note-file (safe))
  257. (message "    Please read the release notes from the patch archive. "
  258.      "They contain valuable info you cannot afford to miss."
  259.      )
  260.  
  261. (complete 00) (transcript "Patching " app-name ".")
  262. (complete 01) (check-user-level)
  263. (complete 04) (check-atcp-assign)
  264. (set @default-dest current-atcp-directory)
  265.  
  266. (complete 05) (check-amitcp-41)
  267.  
  268. (while (<> 0 (getversion "bsdsocket.library" (resident)))
  269.   (message "\nYou are running AmiTCP/IP.\n"
  270.        "Please stop it before continuing patch with\n"
  271.        "`stopnet' command"))
  272.  
  273. ;;; login
  274. (set
  275.  file-name "bin/login"
  276.  checksum  $38A547A3
  277.  spatch-file-name "login.pch")
  278. (spatch-file-1)
  279. (complete 20)
  280.  
  281. ;;; online
  282. (set
  283.  file-name "bin/online"
  284.  checksum  $8E2B0B3F
  285.  spatch-file-name "online.pch")
  286. (spatch-file-1)
  287. (complete 30)
  288.  
  289. ;;; bootpconfig
  290. (set
  291.  file-name "bin/bootpconfig"
  292.  checksum  $AA9444B1
  293.  spatch-file-name "bootpconfig.pch")
  294. (spatch-file-1)
  295. (complete 40)
  296.  
  297. ;;; AmiTCP.guide
  298. (set
  299.  file-name "help/AmiTCP.guide"
  300.  checksum  $AA49F582
  301.  spatch-file-name "AmiTCP.guide.pch")
  302. (spatch-file-1)
  303. (complete 50)
  304.  
  305. ;;; Config_AmiTCP
  306. (set
  307.  file-name "Config_AmiTCP"
  308.  checksum  $65F5DAEB
  309.  spatch-file-name "Config_AmiTCP.pch")
  310. (spatch-file-1)
  311. (complete 60)
  312.  
  313. ;;; Interfaces
  314. (set 
  315.  file-name "db/interfaces"
  316.  patch-file-name "interfaces.patch")
  317. (patch-file)
  318. (complete 70)
  319.  
  320. ;;;; AmiTCP.020
  321. (set at-020-name (tackon atcp-assign "AmiTCP.020"))
  322. (set at-000-name (tackon atcp-assign "AmiTCP.000"))
  323.  
  324. (set
  325.  file-name (if (exists at-020-name) "AmiTCP.020" "AmiTCP.000")
  326.  checksum-2 $e7301a5e
  327.  spatch-2 "AmiTCP.020.pch"
  328.  checksum-1 $68e7efd4
  329.  spatch-1 "AmiTCP.000.pch")
  330. (spatch-file-2)
  331. (complete 85)
  332.  
  333. ;;;; AmiTCP(.000)
  334. (set
  335.  file-name "AmiTCP"
  336.  checksum-1 $68e7efd4
  337.  spatch-1 "AmiTCP.000.pch"
  338.  checksum-2 $e7301a5e
  339.  spatch-2 "AmiTCP.020.pch")
  340. (spatch-file-2)
  341. (complete 100)                ; All done!
  342.  
  343. (message 
  344.  "\nAmITCP/IP 4.1 to 4.2 patch applied succesfully.\n")
  345.  
  346. (exit (quiet))
  347. ; EOF
  348.